import { NextResponse } from 'next/server'
import { currentUser, auth } from '@clerk/nextjs/server'

export async function GET() {
  //获取用户信息，有则为登录
  const { userId } = auth()

  if (!userId) {
    return new NextResponse('Unauthorized', { status: 401 })
  }

  // 执行路由处理程序的逻辑

  const user = await currentUser()

  return NextResponse.json({ user: user }, { status: 200 })
}
